﻿using System.Collections.Generic;

namespace FunctionalProgramming.PatternMatching.CollectionMatchingRules
{
   /// <summary>
   /// Rule that matches collections.
   /// </summary>
   /// <typeparam name="T">Type of elements of collection to match.</typeparam>
   internal interface ICollectionMatchingRule<T>
   {
      /// <summary>
      /// Examines the provided collection and determines whether it matches the rule or not.
      /// </summary>
      /// <param name="collection">The collection.</param>
      /// <returns><c>true</c> if the collection matches the rule; otherwise, <c>false</c>.</returns>
      bool DoesCollectionMatch(IEnumerable<T> collection);

      /// <summary>
      /// Invokes the action function with the provided collection.
      /// </summary>
      /// <param name="collection">The collection.</param>
      void ExecuteWithCollection(IEnumerable<T> collection);
   }
}